<include file="Public/min-header" />
<div class="wrapper">
    <include file="Public/breadcrumb" />
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header">
                        <nav class="navbar navbar-default">
                            <div class="collapse navbar-collapse">
                                <form class="navbar-form form-inline" action="{:U('Admin/Promotion/PromotionList')}" method="post">
                                    <div class="form-group">
                                        <input type="text" name="keywords" class="form-control" placeholder="搜索">
                                    </div>
                                    <button type="submit" class="btn btn-primary">提交</button>
                                    <div class="form-group">(温馨提示：开始后的活动无法进行修改)</div>
                                    <div class="form-group pull-right">
                                        <a href="{:U('Admin/Promotion/c_detail')}" class="btn btn-primary pull-right"><i class="fa fa-plus"></i>添加</a>
                                    </div>
                                </form>
                            </div>
                        </nav>
                    </div>
                    <div class="box-body">
                        <div class="row">
                            <div class="col-sm-12">
                                <table id="list-table" class="table table-bordered table-striped dataTable" role="grid" aria-describedby="example1_info">
                                    <thead>
                                    <tr role="row">
                                        <th class="sorting_asc" tabindex="0" aria-controls="example1" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Rendering engine: activate to sort column descending" style="width: 294px;">优惠券标题</th>
                                        <th class="sorting" tabindex="0" aria-controls="example1" aria-label="Platform(s): activate to sort column ascending">使用门槛</th>
                                        <th class="sorting" tabindex="0" aria-controls="example1" aria-label="Platform(s): activate to sort column ascending">优惠券面值</th>
                                        <th class="sorting" tabindex="0" aria-controls="example1" aria-label="Platform(s): activate to sort column ascending">优惠券数量</th>
                                        <th class="sorting" tabindex="0" aria-controls="example1" aria-label="Platform(s): activate to sort column ascending">已发放数量</th>
                                        <th class="sorting" tabindex="0" aria-controls="example1" aria-label="Platform(s): activate to sort column ascending">使用数量</th>
                                        <th class="sorting" tabindex="0" aria-controls="example1" aria-label="Platform(s): activate to sort column ascending">开始时间</th>
                                        <th class="sorting" tabindex="0" aria-controls="example1" aria-label="Platform(s): activate to sort column ascending">结束时间</th>
                                        <th class="sorting" tabindex="0" aria-controls="example1" aria-label="Engine version: activate to sort column ascending">发布时间</th>
                                        <th class="sorting" tabindex="0" aria-controls="example1" aria-label="Platform(s): activate to sort column ascending">状态</th>
                                        <th class="sorting" tabindex="0" aria-controls="example1" aria-label="CSS grade: activate to sort column ascending">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <foreach name="couponList" item="vo" key="k">
                                        <tr role="row" align="center">
                                            <td style="line-height:34px;">{$vo.title|getSubstr=0,33}</td>
                                            <td style="line-height:34px;">{$vo.use_price}</td>
                                            <td style="line-height:34px;">{$vo.coupon_price}</td>
                                            <td style="line-height:34px;">{$vo.coupon_number}</td>
                                            <td style="line-height:34px;">{$vo.issued}</td>
                                            <td style="line-height:34px;">{$vo.user_issued}</td>
                                            <td style="line-height:34px;">{$vo.start_time|date="Y-m-d H:i:s",###}</td>
                                            <td style="line-height:34px;">{$vo.end_time|date="Y-m-d H:i:s",###}</td>
                                            <td style="line-height:34px;">{$vo.add_time|date="Y-m-d H:i:s",###}</td>
                                            <td style="line-height:34px;">
                                                <img width="20" height="20" src="__PUBLIC__/images/<if condition='$vo[status] eq 1'>yes.png<else />cancel.png</if>" onclick="changeTableVal('goods_cat', 'id', '{$vo.id}', 'is_show', this)" />
                                            </td>
                                            <td>
                                                <a class="btn btn-primary" href="{:U('Promotion/c_detail',array('id'=>$vo['id']))}"><i class="fa fa-pencil"></i></a>
                                                <a class="btn btn-danger" href="javascript:;" data-url="{:U('Promotion/c_del')}" data-id="{$vo.id}" onclick="delfun(this)"><i class="fa fa-trash-o"></i></a>
                                            </td>
                                        </tr>
                                    </foreach>
                                    </tbody>
                                    <tfoot>
                                    </tfoot>
                                </table>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-6 text-left"></div>
                            <div class="col-sm-6 text-right">{$page}</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
</div>
<script>
    function delfun(obj) {
        if (confirm('确认删除')) {
            $.ajax({
                type: 'post',
                url: $(obj).attr('data-url'),
                data: {
                    act: 'del',
                    id: $(obj).attr('data-id')
                },
                dataType: 'json',
                success: function(data) {
                    if (data) {
                        $(obj).parent().parent().remove();
                    } else {
                        layer.alert('删除失败', {
                            icon: 2
                        });
                    }
                }
            });
        }
        return false;
    }
</script>
</body>
</html>
